package com.hkts.beltweigher.master.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.beltweigher.master.entity.HktsHeatItem;
import com.hkts.beltweigher.master.mapper.HktsHeatItemMapper;
import com.hkts.beltweigher.master.service.IHktsHeatItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hkts.beltweigher.synchronizationtask.EnviromentConstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hml
 * @since 2024-04-10
 */
@Service
@Transactional
public class HktsHeatItemServiceImpl extends ServiceImpl<HktsHeatItemMapper, HktsHeatItem> implements IHktsHeatItemService {


    @Autowired
    private HktsHeatItemMapper hktsHeatItemMapper;

    @Override
    public IPage<HktsHeatItem> selectPage(Page<HktsHeatItem> page, HktsHeatItem hktsHeatItem) {
        QueryWrapper<HktsHeatItem> query = Wrappers.query();
        return hktsHeatItemMapper.selectPage(page, query);
    }


    @Override
    public List<HktsHeatItem> selectList(HktsHeatItem hktsHeatItem) {
        QueryWrapper<HktsHeatItem> query = Wrappers.query();
        query.lambda().eq(StringUtils.isNotBlank(hktsHeatItem.getTableId()),HktsHeatItem::getTableId,hktsHeatItem.getTableId())
                .eq(HktsHeatItem::getIsEnable, EnviromentConstance.IS_ENABLE)
                .ne(HktsHeatItem::getNeedDeal,EnviromentConstance.NOT_DEAL_WITH);
        return hktsHeatItemMapper.selectList(query);
    }


}
